Skip to content

fix: scroll to the top when opening a feed on mobile - #317

Merged
therealsama merged 1 commit into
mainfrom
fix/swipe-tab-opens-at-top
Nov 1, 2026
Merged

therealsama merged 1 commit into
mainfrom
fix/swipe-tab-opens-at-top

Conversation

@therealsama

@therealsama therealsama commented Nov 1, 2026 •

Copy link
Copy Markdown
Collaborator

On a phone, scrolling down a story and then tapping a feed tab or the logo opened the new feed's first story partway down, at the offset the previous story was scrolled to.

Cause

The swipe viewer's panels scroll the page itself. A tab or the logo mounts a new viewer, and nothing resets the page's position: the viewer finds its first story already on screen, and the header scrolls to the top only on the feed's own URL, which in swipe mode becomes /item/<id> as soon as a story shows. Desktop isn't affected.

Fix

SwipeStoryViewerCore scrolls to the top when it opens without a story in the URL: a feed tab, the logo, or a domain or user list. A viewer opened on a story (Back, a reload, a link) still restores its saved offset.

@therealsama
therealsama force-pushed the fix/swipe-tab-opens-at-top branch from a5f2255 to 4c46b64 Compare November 1, 2026 18:58
@therealsama therealsama changed the title fix: open a feed's first story at the top on mobile fix: scroll to the top when opening a feed on mobile Nov 1, 2026
@therealsama
therealsama enabled auto-merge November 1, 2026 19:23
On a phone, the story panels scroll the page itself, so the page keeps one
scroll position for whatever is on screen. Tapping a feed tab (or the logo)
mounts a new viewer, which shows its first story without touching that
position: scroll down a Top story, tap Best, and the first Best story opens
partway down its comments.

The viewer now scrolls to the top when it opens without a story in the URL,
which is how a tab, the logo, and a domain or user list open it. A viewer
opened on a story (Back, a reload, a link) leaves the page alone, so its
restore still sets the offset, and the story you left keeps its saved
position for Back.
@therealsama
therealsama force-pushed the fix/swipe-tab-opens-at-top branch from 4c46b64 to c1ea2e0 Compare November 1, 2026 19:27
@therealsama
therealsama merged commit ba390e4 into main Nov 1, 2026
4 checks passed
@therealsama
therealsama deleted the fix/swipe-tab-opens-at-top branch November 1, 2026 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants